package com.tjec.project.system.service.impl;

import com.tjec.project.system.domain.BmsAttachmentChunk;
import com.tjec.project.system.mapper.BmsAttachmentChunkMapper;
import com.tjec.project.system.service.ChunkService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author luoliang
 * @date 2018/6/21
 */
@Service
public class ChunkServiceImpl implements ChunkService {
    @Resource
    private BmsAttachmentChunkMapper bmsAttachmentChunkMapper;

    @Override
    public void saveChunk(BmsAttachmentChunk bmsAttachmentChunk) {
        bmsAttachmentChunkMapper.insertBmsAttachmentChunk(bmsAttachmentChunk);
    }


    @Override
    public boolean checkChunk(BmsAttachmentChunk bmsAttachmentChunk) {
        List<BmsAttachmentChunk> list = bmsAttachmentChunkMapper.selectBmsAttachmentChunkList(bmsAttachmentChunk);
        return CollectionUtils.isEmpty(list);
    }
}
